Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
Why does String#localeCompare put "ʻ" (ʻOkina) between H and I?

Background

ʻ, the ʻOkina, Unicode code point U+02BB MODIFIER LETTER TURNED COMMA, is:

a unicameral consonant letter used within the Latin script to mark the phonemic glottal stop, in many Polynesian languages

Not to be confused with ' or even ‘, which are straight and curly single-quotation marks, respectively.

Question

Why does this:

[...'hiʻ'].sort((a, b) => a.localeCompare(b)).join('')

Yield hʻi as its answer? In other words, on what basis does localeCompare judge that the ʻOkina comes after H and before I in the alphabet?

The ECMAScript standard simply mentions that "The two Strings are compared in an implementation-defined fashion", yet both Chromium and Firefox are in agreement about this ordering, at least in the en-US locale.

It seems most (all?) languages that include ‘ in their alphabets simply place it at the end. Is there some Unicode standard somewhere that defines alphabetical ordering that both Chromium and Firefox use? Or if not, where did they both get the idea that ‘ falls between H and I?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Wow, that is really interesting placement.

Is there some Unicode standard somewhere that defines alphabetical ordering that both Chromium and Firefox use?

Yes. Collation (as it's called) is a big topic. It's covered in various places by Unicode, for instance in Unicode Technical Report 10 and at least in part in TR15. I haven't found a specific rationale for how the ʻOkina is handled, but in general as I understand it the rules are designed to ensure that a locale (not just language) can specify how characters are collated in that locale.

That doesn't necessarily mean the placement will make sense in an English-speaking locale like en-US or en-GB, but hopefully in a locale properly supporting Polynesian languages, it would be collated in a way that makes sense.

I'm not sure this is an answer so much as a pointer to where to find one. I wish I could point to the specific reason. I'm sure there is one, it hasn't just been put there randomly. It (the reason) will likely be in the collation data files in a comment. Or a native speaker might be able to say off the top of their head "Well of course that's where it goes, because ________."

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!